﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Docking = WeifenLuo.WinFormsUI.Docking;
using EdytorWF.Objects;

namespace EdytorWF
{
    public partial class TypesObjectDlg : Docking::DockContent
    {
        public String ObjectTypeName;
        public TypesObjectDlg()
        {
            InitializeComponent();

            AllowEndUserDocking = true;
            AutoScaleDimensions = new SizeF(6, 13);
            AutoScaleMode = AutoScaleMode.Font;
            ClientSize = new Size(1000, 1000);
            DockAreas = (Docking.DockAreas)(((((Docking.DockAreas.Float
            | Docking.DockAreas.DockTop)
            | Docking.DockAreas.DockBottom)
            | Docking.DockAreas.DockRight)
            | Docking.DockAreas.DockLeft)
            | Docking.DockAreas.Document);
            Name = "Types";
            ShowHint = Docking.DockState.DockRight;
            Text = "Types Dialog";
            TabText = "Types Dialog";

            TypeList.MultiSelect = false;
            TypeList.SelectedIndexChanged += new EventHandler(TypeList_SelectedIndexChanged);
        }

        void TypeList_SelectedIndexChanged(object sender, EventArgs e)
        {
            foreach (int i in TypeList.SelectedIndices)
            {
                if (TypeList.Items[i].Text == "Object")
                {
                    ObjectTypeName = "_MODEL_OBJECT";
                }
                else if (TypeList.Items[i].Text == "Sound")
                {
                    ObjectTypeName = "_SOUND_OBJECT";
                }
                else if (TypeList.Items[i].Text == "Light")
                {
                    ObjectTypeName = "_LIGHT_OBJECT";
                }
                else if (TypeList.Items[i].Text == "Fx")
                {
                    ObjectTypeName = "_PARTICLE_OBJECT";
                }
            }
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            LoadItems();
        }

        private void LoadItems()
        {
            TypeList.View = View.LargeIcon;

            Icon object_icon = new System.Drawing.Icon("..\\..\\Resources\\Icons\\ObjectIcon.ico");
            LargeImageList.Images.Add(object_icon);
            Icon sound_icon = new System.Drawing.Icon("..\\..\\Resources\\Icons\\SoundIcon.ico");
            LargeImageList.Images.Add(sound_icon);
            Icon light_icon = new System.Drawing.Icon("..\\..\\Resources\\Icons\\LightIcon.ico");
            LargeImageList.Images.Add(light_icon);
            Icon fx_icon = new System.Drawing.Icon("..\\..\\Resources\\Icons\\FxIcon.ico");
            LargeImageList.Images.Add(fx_icon);

            TypeList.LargeImageList = LargeImageList;
            TypeList.Items.Add("Object",0);
            TypeList.Items.Add("Sound",1);
            TypeList.Items.Add("Light",2);
            TypeList.Items.Add("Fx",3);

            TypeList.Items[0].Selected = true;
            ObjectTypeName = "_MODEL_OBJECT";
        }

        private void TypesObjectDlg_MouseEnter(object sender, EventArgs e)
        {
            TypeList.Focus();
        }
    }
}
